<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>用户管理</title>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/back-index.css" />
    <script src="${pageContext.request.contextPath}/js/jquery.js" type="text/javascript" charset="utf-8"></script>
    <script src="${pageContext.request.contextPath}/js/bootstrap.js" type="text/javascript" charset="utf-8"></script>
    <script src="${pageContext.request.contextPath}/js/bootstrap-paginator.js"></script>
    <script src="${pageContext.request.contextPath}/js/bootstrap-mypaginator.js"></script>
    <script type="text/javascript" charset="utf-8">
        $(function() {
            // 显示隐藏查询列表
            $('#show-user-search').click(function() {
                $('#show-user-search').hide();
                $('#upp-user-search').show();
                $('.showusersearch').slideDown(500);
            });
            $('#upp-user-search').click(function() {
                $('#show-user-search').show();
                $('#upp-user-search').hide();
                $('.showusersearch').slideUp(500);
            });


            $(".doModify").on("click", function() {
                $(".modal-title").html("用户修改");
                $("#myModal").modal("show");
            });
            $(".updateOne").on("click", function() {
                $("#myModal").modal("hide");
            });

            //ajax分页
            //分页回调函数,点击按钮事件
            myoptions.onPageClicked = function(event, originalEvent, type, page) {
                //ajax回调接收数据成功时再重新初始化分页按钮
                console.log("pageNo=", page);

                //success: function(data){
                //	var pageInfo = data.obj;
                //	myPaginatorFun("myPages", pageInfo.pageNum, pageInfo.pages);
                //}
            };
            myPaginatorFun("myPages", 3, 20);
        });
        //ajax回调接收数据成功时再重新初始化分页按钮
        function ajaxLoadData(data, url, page){
            //TODO:
        }
        //ajaxLoadData("", url, 1);

    </script>

</head>

<body>
<div class="panel panel-default" id="userInfo">
    <div class="panel-heading">
        <h3 class="panel-title">用户管理</h3>
    </div>
    <div>
        <input type="button" value="查询" class="btn btn-success" id="doSearch"
               style="margin: 5px 5px 5px 15px;" />
        <input type="button"
               class="btn btn-primary" id="show-user-search" value="展开搜索" />
        <input
                type="button" value="收起搜索" class="btn btn-primary"
                id="upp-user-search" style="display: none;" />
    </div>

    <div class="panel-body">
        <div class="showusersearch" style="display: none;">
            <form class="form-horizontal">
                <div class="form-group">
                    <div class="form-group col-xs-6">
                        <label for="user_name" class="col-xs-3 control-label">登录名：</label>
                        <div class="col-xs-8">
                            <input type="text" class="form-control" id="user_name"
                                   placeholder="请输入登录名" />
                        </div>
                    </div>
                    <div class="form-group col-xs-6">
                        <label for="user_nickname" class="col-xs-3 control-label">昵称：</label>
                        <div class="col-xs-8">
                            <input type="text" class="form-control" id="user_nickname"
                                   placeholder="请输入昵称" />
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="form-group col-xs-6">
                        <label for="user_phone" class="col-xs-3 control-label">手机号</label>
                        <div class="col-xs-8">
                            <input type="text" class="form-control" id="user_phone"
                                   placeholder="请输入手机号" />
                        </div>
                    </div>
                    <div class="form-group col-xs-6">
                        <label for="role_name" class="col-xs-3 control-label">角色：</label>
                        <div class="col-xs-8">
                            <select class="form-control" id="role_name" name="role_name">
                                <option value="-1">全部</option>
                                <option value="normal">普通</option>
                                <option value="admin">管理员</option>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="form-group col-xs-6">
                        <label class="col-xs-3 control-label">开始日期：</label>
                        <div class="col-xs-8">
                            <input type="text" class="form-control"
                                   placeholder="请输入创建开始时间:2018-10-10" />
                        </div>
                    </div>
                    <div class="form-group col-xs-6">
                        <label class="col-xs-3 control-label">结束日期：</label>
                        <div class="col-xs-8">
                            <input type="text" class="form-control"
                                   placeholder="请输入创建结束时间:2018-10-12" />
                        </div>
                    </div>
                </div>

            </form>
        </div>
        <div class="show-list">
            <table class="table table-bordered table-hover"
                   style='text-align: center;'>
                <thead>
                <tr class="text-danger">
                    <th class="text-center">编号</th>
                    <th class="text-center">登录名</th>
                    <th class="text-center">密码</th>
                    <th class="text-center">昵称</th>
                    <th class="text-center">手机号</th>
                    <th class="text-center">创建日期</th>
                    <th class="text-center">操作</th>
                </tr>
                </thead>
                <tbody id="tb">
                <tr>
                    <td>1</td>
                    <td>cc1</td>
                    <td>123456</td>
                    <td>aaa</td>
                    <td>12345678901</td>
                    <td>2017-12-25 10:00:00</td>
                    <td class="text-center"><input type="button"
                                                   class="btn btn-warning btn-sm doModify" value="修改" /> <input
                            type="button" class="btn btn-danger btn-sm" value="禁用" /></td>
                </tr>
                <tr>
                    <td>2</td>
                    <td>cc2</td>
                    <td>000000</td>
                    <td>ccc</td>
                    <td>12345678902</td>
                    <td>2017-12-25 10:30:00</td>
                    <td class="text-center"><input type="button"
                                                   class="btn btn-warning btn-sm doModify" value="修改" /> <input
                            type="button" class="btn btn-success btn-sm" value="启用" /></td>
                </tr>
                </tbody>
            </table>
        </div>
        <!-- 分页 -->
        <div style="text-align: center;">
            <ul id="myPages"></ul>
        </div>

        <div class="modal fade" tabindex="-1" id="myModal">
            <!-- 窗口声明 -->
            <div class="modal-dialog modal-lg">
                <!-- 内容声明 -->
                <div class="modal-content">
                    <!-- 头部、主体、脚注 -->
                    <div class="modal-header">
                        <button class="close" data-dismiss="modal">&times;</button>
                        <h4 class="modal-title">用户修改</h4>
                    </div>
                    <div class="modal-body text-center">
                        <div class="row text-right">
                            <label for="user_id" class="col-xs-4 control-label">编号：</label>
                            <div class="col-xs-4">
                                <input type="text" class="form-control" id="user_id"
                                       readonly="true" />
                            </div>
                        </div>
                        <br>
                        <div class="row text-right">
                            <label for="username" class="col-xs-4 control-label">昵称：</label>
                            <div class="col-xs-4">
                                <input type="text" class="form-control" id="username" />
                            </div>
                        </div>
                        <br>
                        <div class="row text-right">
                            <label for="roleName" class="col-xs-4 control-label">角色：</label>
                            <div class="col-xs-4">
                                <select class="form-control" id="roleName" name="roleName">
                                    <option value="normal">普通</option>
                                    <option value="admin">管理员</option>
                                </select>
                            </div>
                        </div>
                        <br>
                        <div class="row text-right">
                            <label for="password" class="col-xs-4 control-label">新密码：</label>
                            <div class="col-xs-4">
                                <input type="text" class="form-control" id="password" placeholder="不修改密码时,不填写" />
                            </div>
                        </div>
                        <br>
                        <div class="row text-right">
                            <label for="repassword" class="col-xs-4 control-label">确认密码：</label>
                            <div class="col-xs-4">
                                <input type="text" class="form-control" id="repassword" placeholder="不修改密码时,不填写" />
                            </div>
                        </div>
                        <br>
                        <div class="row text-right">
                            <label for="phone" class="col-xs-4 control-label">手机号：</label>
                            <div class="col-xs-4">
                                <input type="email" class="form-control" id="phone" />
                            </div>
                        </div>
                        <br>
                    </div>
                    <div class="modal-footer">
                        <button class="btn btn-warning updateOne">修改</button>
                        <button class="btn btn-primary cancel" data-dismiss="modal">取消</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>

</html>
